package com.xqboss.apps.dto.user;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xqboss.apps.dto.PageDto;
import com.xqboss.apps.enums.nft.NftTypeEnum;
import com.xqboss.apps.enums.nft.UserNftStatusEnum;
import com.xqboss.apps.enums.user.UserNftSourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Objects;

/**
 * <p>
 *     用户藏品列表请求
 * </p>
 * @author Trent
 * @date 2023/8/30
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel
public class WebUserNftListDto extends PageDto {

    @ApiModelProperty("用户ID（APP不用传）")
    private Long userId;

    @ApiModelProperty("藏品类型")
    private NftTypeEnum nftType;

    @ApiModelProperty("藏品状态")
    private UserNftStatusEnum nftStatus;

    @ApiModelProperty("藏品来源")
    private UserNftSourceTypeEnum source;

    @ApiModelProperty("开始时间")
    private LocalDateTime createTimeStart;

    @ApiModelProperty("结束时间")
    private LocalDateTime createTimeEnd;

    @ApiModelProperty("搜索（兼容管理台用户详情搜索）")
    private String search;

    @ApiModelProperty("是否按照装备优先级排序, 默认为：否")
    private Boolean sortByEquip;

    @ApiModelProperty(hidden = true)
    @JsonIgnore
    private Long firstUserNftId;


    public LocalDateTime getCreateTimeEnd() {
        if(Objects.nonNull(createTimeEnd)){
            return createTimeEnd.with(LocalTime.MAX);
        }
        return createTimeEnd;
    }
}
